<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Register Page</title>
  <style>
    body {
      margin: 0;
      padding: 0;
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
	  background-image: url('img/register.jpg');
	  background-size: 100% 100%;
    }

    .register-container {
      background: rgba(255, 255, 255, 0.8);
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
      text-align: center;
      width: 700px; /* 调整宽度 */
      margin: auto; /* 让注册框水平居中 */
    }

    input {
      width: 100%;
      padding: 10px;
      margin: 8px 0;
      box-sizing: border-box;
      border: 1px solid #ccc;
      border-radius: 4px;
    }

    button {
      background-color: #4CAF50;
      color: white;
      padding: 10px 20px;
      margin: 8px 0;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }

    button:hover {
      background-color: #45a049;
    }

    #loginLink {
      color: blue;
      text-decoration: none;
      margin-top: 10px;
      display: block;
    }
  </style>
</head>
<body>

<div class="register-container">
  <h2>注册</h2>
  <form action="/user/register" method="post">

    <label for="phone">手机号:</label>
    <input type="text" id="phone" name="phone" required>

    <label for="email">邮箱:</label>
    <input type="email" id="email" name="email" required>

    <label for="password">密码:</label>
    <input type="password" id="password" name="password" required>

    <label for="confirmPassword">确认密码:</label>
    <input type="password" id="confirmPassword" name="confirmPassword" required>

    <label for="captcha">验证码:</label>
    <input type="text" id="captcha" name="captcha" required>

    <div id="captchaImageContainer">
      <img id="captchaImage" src="/user/captcha" alt="Captcha">
      <span id="refreshText" onclick="refreshCaptcha()">获取验证码</span>
    </div>

    <button type="submit">Register</button>

    <!-- 登录链接 -->
    <a href="login.html" id="loginLink">已有账号？点我登录</a>
  </form>
  <script>
    function refreshCaptcha() {
      var captchaImage = document.getElementById('captchaImage');
      var timestamp = Date.now(); // 获取当前时间戳
      captchaImage.src = '/user/captcha?' + timestamp; // 添加时间戳参数强制刷新验证码
    }
  </script>
</div>

</body>
</html>